package V1

import (
	"ginStudy/model"
	"ginStudy/utils/errmsg"
	"github.com/gin-gonic/gin"
	"net/http"
)

/**
* @Author: 俊杰
* @Description: 用户模块
* @File: user
* @Version: 1.0.0
* @Date: 2022/5/26 19:47
 */

var code int

// AddUser 添加用户
func AddUser(c *gin.Context) {
	var data model.User
	_ = c.ShouldBindJSON(&data)


	code := model.CheckUser(data.Username)
	if code == errmsg.SUCCSE {
		model.CreateUser(&data)
	}

	c.JSON(
		http.StatusOK, gin.H{
			"status":  code,
			"message": errmsg.GetErrMsg(code),
		},
	)
}

// GetUserInfo 查询单个用户
func GetUserInfo(c *gin.Context) {

}

// GetUsers 查询用户列表
func GetUsers(c *gin.Context) {

}

// EditUser 编辑用户
func EditUser(c *gin.Context) {

}

// ChangeUserPassword 修改密码
func ChangeUserPassword(c *gin.Context) {

}

// DeleteUser 删除用户
func DeleteUser(c *gin.Context) {

}